package com.cardone.platform.configuration.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.configuration.dao.DictionaryItemDao;
import com.cardone.platform.configuration.dto.DictionaryItemDto;

/**
 * 字典项服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class DictionaryItemDefaultService implements DictionaryItemService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, DictionaryItemDto saveDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).saveByIdOrCode(mappedClass, saveDictionaryItem);
	}
	
	@Override
	@Transactional
	public DictionaryItemDto saveByIdOrCode(DictionaryItemDto saveDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).saveByIdOrCode(DictionaryItemDto.class, saveDictionaryItem);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, DictionaryItemDto findDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findByCodeOrId(mappedClass, findDictionaryItem);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(DictionaryItemDto readDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).readByCodeNqIdForCount(readDictionaryItem);
	}
	
	@Override
	@Transactional
	public int insertByCode(DictionaryItemDto insertDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).insertByCode(insertDictionaryItem);
	}
	
	@Override
	@Transactional
	public int updateByCode(DictionaryItemDto updateDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).updateByCode(updateDictionaryItem);
	}

	@Override
	@Transactional
	public int deleteByIds(DictionaryItemDto deleteDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).deleteByIds(deleteDictionaryItem);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, DictionaryItemDto findDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findById(mappedClass, findDictionaryItem);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, DictionaryItemDto findListDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).findListByLikeCode(mappedClass, findListDictionaryItem);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(DictionaryItemDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, DictionaryItemDto paginationDictionaryItem) {
		return ContextHolder.getBean(DictionaryItemDao.class).paginationByLikeCode(mappedClass, paginationDictionaryItem);
	}
}